<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>货品批次出入库明细页面</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>

<style type="text/css">
#searchbar{
   margin-bottom: 10px;
   margin-left:15px;
  }
  .navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search {
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>

<body style="padding:6px; overflow:hidden;">
<div class="navbar">
		<span>您当前的位置：商品管理 &gt</span>
		货品批次出入库明细列表
</div><br>
<form action="#"  name="queryForm" id="queryForm" method="POST">
		仓库编码：<input type="text" id="whCode" name="whCode" size="18" maxLength="40" value="${pbiod.whCode }">&nbsp;&nbsp;&nbsp;&nbsp;
		单号：<input type="text" id="orderNo" name="orderNo" size="18" maxLength="40" value="${pbiod.orderNo }">&nbsp;&nbsp;&nbsp;&nbsp;
		货品编号：<input type="text" id="prodNo" name="prodNo" size="18" maxLength="40" value="${pbiod.prodNo }"><br><br>
    	出入库类型:<select id="moduleCode" name="moduleCode">
				    <option value=""  <c:if test="${pbiod.moduleCode == ''}">selected</c:if>>请选择</option>
				    <option value="0001"  <c:if test="${pbiod.moduleCode == '0001'}">selected</c:if>>其他入库</option>
				   	<option value="0002"  <c:if test="${pbiod.moduleCode == '0002'}">selected</c:if>>其他出库</option>
					<option value="0003"  <c:if test="${pbiod.moduleCode == '0003'}">selected</c:if>>采购入库</option> 
					<option value="0007"  <c:if test="${pbiod.moduleCode == '0007'}">selected</c:if>>配货单出库</option> 
					<option value="0008"  <c:if test="${pbiod.moduleCode == '0008'}">selected</c:if>>销售退货入库</option> 
					<option value="0009"  <c:if test="${pbiod.moduleCode == '0009'}">selected</c:if>>采购退货出库</option>
					<option value="sd001"  <c:if test="${pbiod.moduleCode == 'sd001'}">selected</c:if>>手动出库</option>  
				   </select>&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="submit" value="查询" class="l-button-search"  >&nbsp;&nbsp;&nbsp;&nbsp;<input  type="button" id="resetButton" value="重置" class="l-button-search" >
	</form><br>
<div id="maingrid" style="margin:0; padding:0"></div>
  <div style="display:none;">
  <!-- 展示列表数据  -->
</div><br><br>

	<script>
	var grid = null;
    $(function () {
    	$('#resetButton').click(function() {
        	$('#whCode').val('');
        	$('#orderNo').val('');
        	$('#prodNo').val('');
        	$("select").find("option[value='']").attr("selected","true");  
        });
    	grid = $("#maingrid").ligerGrid({
            columns: [
            { display: '仓库编码', name: 'whCode',align: 'left' },
            { display: '供应商编码', name: 'suppNo' },
            { display: '单号', name: 'orderNo' },
            { display: 'WMS单号', name: 'wmsNo' },
            { display: '出库对应入库单号', width: '120', name: 'poChNo' },
            { display: '出入库类型', name: 'moduleCode', render: function(rowdata, rowindex, value) {
            	var text = '';
            	if (rowdata.moduleCode == '0001') {
            		text = '其他入库';
            	} else if (rowdata.moduleCode == '0002') {
            		text = '其他出库';
            	} else if (rowdata.moduleCode == '0003') {
            		text = '采购入库';
            	} else if (rowdata.moduleCode == '0007') {
            		text = '配货单出库';
            	} else if (rowdata.moduleCode == '0008') {
            		text = '销售退货入库';
            	} else if (rowdata.moduleCode == '0009') {
            		text = '采购退货出库';
            	}else if (rowdata.moduleCode == 'sd001') {
             		text = '手动出库';
             	}
            	return text;
            } },
            { display: '货品编号', name: 'prodNo'},
            { display: '货品原价 ', render: function(rowdata, rowindex, value) {
            	if (rowdata.moduleCode == '0001' || rowdata.moduleCode == '0003'){
            		return rowdata.prodPrice;
            	}
            	return new String(rowdata.oldProdPrice);
            }
            },
            { display: '货品单价 ', name: 'prodPrice'},
            { display: '变动单价', render: function(rowdata, rowindex, value) {
            	if (isNaN(rowdata.oldProdPrice)) rowdata.oldProdPrice = 0.00;
            	if (isNaN(rowdata.prodPrice)) rowdata.prodPrice = 0.00;
            	if (rowdata.moduleCode == '0002' || rowdata.moduleCode == '0007' || rowdata.moduleCode == '0009') {
            		if(rowdata.oldProdPrice==""){
            			return '0';
            		}
            		return String(rowdata.prodPrice - rowdata.oldProdPrice);
            	} else {
            		return '0';
            	}
            }},
            { display: '出入库数量', name: 'amount' },
            { display: '出入库金额', name: 'price' },
            { display: '出入库时间', name: 'dateTime',align: 'left' }
            ], 
            pageSize:30,
            width: '100%',
            height: '100%',
            dataType: 'server', 
            dataAction: 'server',
            pagesizeParmName: 'pageSize',
            parms: [
                    {name: "whCode", value:$("#whCode").val()},
                    {name: "orderNo", value:$("#orderNo").val()},
                    {name: "prodNo", value:$("#prodNo").val()},
                    {name: "moduleCode", value:$("#moduleCode").val()},
                    
            	],
            url: "list_prod_batch_in_out_detail.do",
            toolbar: { items:[{ text: "手动出库", click: addInOutDetail, icon: "add"},{ line: true }] }
        });
   	});
    function addInOutDetail(){
    	var m=$.ligerDialog.open({title:'手动差额录入',url:'${BasePath}/manager/statistics/prodBatchInRecord/outChange.do?',height:350,width:600,isResize: false, isDrag: false });
    	m.show(); 
    }
    </script>
	
</body>
</html>